package communication.common.business.heartbeat;


import communication.common.business.base.FcrAutoConfig;
import communication.common.business.base.FcrProtocolConfig;
import communication.common.business.base.RemoteServerAutoConfig;
import communication.common.vertx.net.NetManager;

import java.util.Iterator;

/**
 * client端的心跳处理服务，主要是用来 :发送心跳, 处理心跳应答 ，心跳发送间隔检查
 * @author mac
 */
public class HeartBeatServiceOfClient extends HeartBeatServiceCommon{


    public HeartBeatServiceOfClient(NetManager netManager, FcrAutoConfig fcrAutoConfig) throws Exception {
        super(netManager,fcrAutoConfig);
    }




    @Override
    public void setTask() throws Exception {
        this.getThreadPoolExecutor().submit(new Runnable() {
            @Override
            public void run() {
                checkPeriodAllHeartBeat();
            }
        });

        // 处理打洞流程建立的无效的socket
        this.getThreadPoolExecutor().submit(new Runnable() {
            @Override
            public void run() {
                getNetManager().holeTimeOutHoleConnectRecord();
            }
        });

    }
}
